Notebook[{

Cell[CellGroupData[{
Cell["Variation of Lagrangian with xPert and VarD", "Subtitle"],

Cell["\<\
Leo C. Stein (leo.stein@gmail.com)
August 2013\
\>", "Subsubtitle"],

Cell["\<\
Summary: A common usage pattern for varying a Lagrangian.
VarD doesn\[CloseCurlyQuote]t know more complicated math like the variation \
of a curvature tensor with respect to the metric. However, xPert does, so \
combining them makes it straightforward to vary Lagrangian.\
\>", "Subsubtitle"],

Cell[CellGroupData[{

Cell["0. Setup", "Subsubsection"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Needs", "[", "\"\<xAct`xPert`\>\"", "]"}]], "Input"],

Cell[CellGroupData[{

Cell[BoxData["\<\"------------------------------------------------------------\
\"\>"], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"Package xAct`xPerm`  version \"\>", 
   "\[InvisibleSpace]", "\<\"1.2.0\"\>", "\[InvisibleSpace]", "\<\", \"\>", 
   "\[InvisibleSpace]", 
   RowBox[{"{", 
    RowBox[{"2013", ",", "1", ",", "27"}], "}"}]}],
  SequenceForm["Package xAct`xPerm`  version ", "1.2.0", ", ", {2013, 1, 27}],
  
  Editable->False]], "Print"],

Cell[BoxData["\<\"CopyRight (C) 2003-2013, Jose M. Martin-Garcia, under the \
General Public License.\"\>"], "Print"],

Cell[BoxData["\<\"Connecting to external mac executable...\"\>"], "Print"],

Cell[BoxData["\<\"Connection established.\"\>"], "Print"],

Cell[BoxData["\<\"------------------------------------------------------------\
\"\>"], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"Package xAct`xTensor`  version \"\>", 
   "\[InvisibleSpace]", "\<\"1.0.5\"\>", "\[InvisibleSpace]", "\<\", \"\>", 
   "\[InvisibleSpace]", 
   RowBox[{"{", 
    RowBox[{"2013", ",", "1", ",", "27"}], "}"}]}],
  SequenceForm[
  "Package xAct`xTensor`  version ", "1.0.5", ", ", {2013, 1, 27}],
  Editable->False]], "Print"],

Cell[BoxData["\<\"CopyRight (C) 2002-2013, Jose M. Martin-Garcia, under the \
General Public License.\"\>"], "Print"],

Cell[BoxData["\<\"------------------------------------------------------------\
\"\>"], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"Package xAct`xPert`  version \"\>", 
   "\[InvisibleSpace]", "\<\"1.0.3\"\>", "\[InvisibleSpace]", "\<\", \"\>", 
   "\[InvisibleSpace]", 
   RowBox[{"{", 
    RowBox[{"2013", ",", "1", ",", "27"}], "}"}]}],
  SequenceForm["Package xAct`xPert`  version ", "1.0.3", ", ", {2013, 1, 27}],
  
  Editable->False]], "Print"],

Cell[BoxData["\<\"CopyRight (C) 2005-2013, David Brizuela, Jose M. \
Martin-Garcia and Guillermo A. Mena Marugan, under the General Public \
License.\"\>"], "Print"],

Cell[BoxData["\<\"------------------------------------------------------------\
\"\>"], "Print"],

Cell[BoxData["\<\"These packages come with ABSOLUTELY NO WARRANTY; for \
details type Disclaimer[]. This is free software, and you are welcome to \
redistribute it under certain conditions. See the General Public License for \
details.\"\>"], "Print"],

Cell[BoxData["\<\"------------------------------------------------------------\
\"\>"], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"** Variable \"\>", "\[InvisibleSpace]", "$PrePrint", 
   "\[InvisibleSpace]", "\<\" assigned value \"\>", "\[InvisibleSpace]", 
   "ScreenDollarIndices"}],
  SequenceForm[
  "** Variable ", $PrePrint, " assigned value ", 
   xAct`xTensor`ScreenDollarIndices],
  Editable->False]], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"** Variable \"\>", "\[InvisibleSpace]", "$CovDFormat", 
   "\[InvisibleSpace]", "\<\" changed from \"\>", 
   "\[InvisibleSpace]", "\<\"Prefix\"\>", "\[InvisibleSpace]", "\<\" to \"\>",
    "\[InvisibleSpace]", "\<\"Postfix\"\>"}],
  SequenceForm[
  "** Variable ", xAct`xTensor`$CovDFormat, " changed from ", "Prefix", 
   " to ", "Postfix"],
  Editable->False]], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"** Option \"\>", "\[InvisibleSpace]", "AllowUpperDerivatives", 
   "\[InvisibleSpace]", "\<\" of \"\>", "\[InvisibleSpace]", "ContractMetric",
    "\[InvisibleSpace]", "\<\" changed from \"\>", "\[InvisibleSpace]", 
   "False", "\[InvisibleSpace]", "\<\" to \"\>", "\[InvisibleSpace]", "True"}],
  SequenceForm[
  "** Option ", xAct`xTensor`AllowUpperDerivatives, " of ", 
   xAct`xTensor`ContractMetric, " changed from ", False, " to ", True],
  Editable->False]], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"** Option \"\>", "\[InvisibleSpace]", "MetricOn", 
   "\[InvisibleSpace]", "\<\" of \"\>", "\[InvisibleSpace]", "MakeRule", 
   "\[InvisibleSpace]", "\<\" changed from \"\>", "\[InvisibleSpace]", "None",
    "\[InvisibleSpace]", "\<\" to \"\>", "\[InvisibleSpace]", "All"}],
  SequenceForm[
  "** Option ", xAct`xTensor`MetricOn, " of ", xAct`xTensor`MakeRule, 
   " changed from ", None, " to ", All],
  Editable->False]], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"** Option \"\>", "\[InvisibleSpace]", "ContractMetrics", 
   "\[InvisibleSpace]", "\<\" of \"\>", "\[InvisibleSpace]", "MakeRule", 
   "\[InvisibleSpace]", "\<\" changed from \"\>", "\[InvisibleSpace]", 
   "False", "\[InvisibleSpace]", "\<\" to \"\>", "\[InvisibleSpace]", "True"}],
  SequenceForm[
  "** Option ", xAct`xTensor`ContractMetrics, " of ", xAct`xTensor`MakeRule, 
   " changed from ", False, " to ", True],
  Editable->False]], "Print"],

Cell[BoxData[
 InterpretationBox[
  RowBox[{"\<\"** \"\>", "\[InvisibleSpace]", "DefInertHead", 
   "\[InvisibleSpace]", "\<\": Defining \"\>", 
   "\[InvisibleSpace]", "\<\"inert head \"\>", "\[InvisibleSpace]", 
   "Perturbation", "\[InvisibleSpace]", "\<\". \"\>", 
   "\[InvisibleSpace]", "\<\"\"\>"}],
  SequenceForm[
  "** ", xAct`xTensor`DefInertHead, ": Defining ", "inert head ", 
   xAct`xPert`Perturbation, ". ", ""],
  Editable->False]], "Print"]
}, Open  ]]
}, Open  ]],

Cell["Turn off extra info", "Text"],

Cell[BoxData[
 RowBox[{
  RowBox[{"$DefInfoQ", "=", "False"}], ";"}]], "Input"]
}, Open  ]],

Cell[CellGroupData[{

Cell["1. Example: GR in 4 dimensions", "Subsection"],

Cell["Define a 4-manifold with Lorentzian metric.", "Text"],

Cell[BoxData[{
 RowBox[{"DefManifold", "[", 
  RowBox[{"M4", ",", "4", ",", 
   RowBox[{"IndexRange", "[", 
    RowBox[{"a", ",", "f"}], "]"}]}], "]"}], "\[IndentingNewLine]", 
 RowBox[{"DefMetric", "[", 
  RowBox[{
   RowBox[{"-", "1"}], ",", 
   RowBox[{"g", "[", 
    RowBox[{
     RowBox[{"-", "a"}], ",", 
     RowBox[{"-", "b"}]}], "]"}], ",", "CD"}], "]"}]}], "Input"],

Cell["Define the metric perturbation", "Text"],

Cell[BoxData[
 RowBox[{"DefMetricPerturbation", "[", 
  RowBox[{"g", ",", "h", ",", "\[Epsilon]"}], "]"}]], "Input"],

Cell["\<\
Here\[CloseCurlyQuote]s the Lagrangian density for GR:\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"LGR", "=", 
  RowBox[{
   RowBox[{"Sqrt", "[", 
    RowBox[{"-", 
     RowBox[{"Detg", "[", "]"}]}], "]"}], 
   RowBox[{"RicciScalarCD", "[", "]"}]}]}]], "Input"],

Cell[BoxData[
 RowBox[{
  SqrtBox[
   RowBox[{"-", 
    InterpretationBox[
     StyleBox[
      OverscriptBox["g", 
       OverscriptBox[
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]], 
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]]]],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`Detg[],
     Editable->False]}]], " ", 
  InterpretationBox[
   StyleBox[
    RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
    ShowAutoStyles->False,
    AutoSpacing->False],
   $CellContext`RicciScalarCD[],
   Editable->False]}]], "Output"]
}, Open  ]],

Cell["\<\
First find the linear perturbation, expanding it, then \
contract/canonicalize/simplify.\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"LGRpert", "=", 
  RowBox[{
   RowBox[{
    RowBox[{"ExpandPerturbation", "@", 
     RowBox[{"Perturbation", "@", "LGR"}]}], "//", "ContractMetric"}], "//", 
   "Simplification"}]}]], "Input"],

Cell[BoxData[
 RowBox[{
  FractionBox["1", "2"], " ", 
  SqrtBox[
   RowBox[{"-", 
    InterpretationBox[
     StyleBox[
      OverscriptBox["g", 
       OverscriptBox[
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]], 
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]]]],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`Detg[],
     Editable->False]}]], " ", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{
     RowBox[{"-", "2"}], " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {"h", 
          StyleBox[GridBox[{
             {"1", "a", "b"},
             {" ", " ", " "}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`h[
       xAct`xTensor`LI[1], $CellContext`a, $CellContext`b],
      Editable->False], " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {
          RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}], 
          StyleBox[GridBox[{
             {" ", " "},
             {"a", "b"}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`RicciCD[-$CellContext`a, -$CellContext`b],
      Editable->False]}], "+", 
    RowBox[{
     InterpretationBox[
      StyleBox[GridBox[{
         {"h", 
          StyleBox[GridBox[{
             {"1", "a", " "},
             {" ", " ", "a"}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`h[
       xAct`xTensor`LI[1], $CellContext`a, -$CellContext`a],
      Editable->False], " ", 
     InterpretationBox[
      StyleBox[
       RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`RicciScalarCD[],
      Editable->False]}], "+", 
    RowBox[{"2", " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {"h", 
          StyleBox[GridBox[{
             {"1", "a", "b", "  ", "  "},
             {" ", " ", " ", 
              RowBox[{";", "a"}], 
              RowBox[{";", "b"}]}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`CD[-$CellContext`b][
       $CellContext`CD[-$CellContext`a][
        $CellContext`h[
         xAct`xTensor`LI[1], $CellContext`a, $CellContext`b]]],
      Editable->False]}], "-", 
    RowBox[{"2", " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {"h", 
          StyleBox[GridBox[{
             {"1", "a", " ", 
              RowBox[{";", "b"}], "  "},
             {" ", " ", "a", "  ", 
              RowBox[{";", "b"}]}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`CD[-$CellContext`b][
       $CellContext`CD[$CellContext`b][
        $CellContext`h[
         xAct`xTensor`LI[1], $CellContext`a, -$CellContext`a]]],
      Editable->False]}]}], ")"}]}]], "Output"]
}, Open  ]],

Cell["\<\
Now perform (minus) the variation with respect to h[LI[1],a,b]. This will \
introduce delta[-LI[1],LI[1]] which is sometimes useful but here we just set \
it to 1.\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"EOMGR0", "=", 
  RowBox[{
   RowBox[{
    RowBox[{"0", "==", 
     RowBox[{
      FractionBox[
       RowBox[{"-", "1"}], 
       RowBox[{"Sqrt", "[", 
        RowBox[{"-", 
         RowBox[{"Detg", "[", "]"}]}], "]"}]], 
      RowBox[{
       RowBox[{"VarD", "[", 
        RowBox[{
         RowBox[{"h", "[", 
          RowBox[{
           RowBox[{"LI", "[", "1", "]"}], ",", "a", ",", "b"}], "]"}], ",", 
         "CD"}], "]"}], "@", "LGRpert"}]}]}], "/.", 
    RowBox[{
     RowBox[{"delta", "[", 
      RowBox[{
       RowBox[{"-", 
        RowBox[{"LI", "[", "1", "]"}]}], ",", 
       RowBox[{"LI", "[", "1", "]"}]}], "]"}], "\[Rule]", "1"}]}], "//", 
   "Expand"}]}]], "Input"],

Cell[BoxData[
 RowBox[{"0", "\[Equal]", 
  RowBox[{
   InterpretationBox[
    StyleBox[GridBox[{
       {
        RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}], 
        StyleBox[GridBox[{
           {" ", " "},
           {"a", "b"}
          },
          GridBoxSpacings->{"Columns" -> {
              Offset[0.], {
               Offset[0.034999999999999996`]}, 
              Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
               Offset[0.]}}, "RowsIndexed" -> {}}],
         FontSize->Rational[39, 4]]}
      },
      GridBoxAlignment->{
       "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Center}}, 
        "RowsIndexed" -> {}},
      GridBoxSpacings->{"Columns" -> {
          Offset[0.27999999999999997`], {
           Offset[0.034999999999999996`]}, 
          Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
          Offset[0.2], {
           Offset[0.4]}, 
          Offset[0.2]}, "RowsIndexed" -> {}}],
     ShowAutoStyles->False,
     AutoSpacing->False],
    $CellContext`RicciCD[-$CellContext`a, -$CellContext`b],
    Editable->False], "-", 
   RowBox[{
    FractionBox["1", "2"], " ", 
    InterpretationBox[
     StyleBox[GridBox[{
        {"g", 
         StyleBox[GridBox[{
            {" ", " "},
            {"a", "b"}
           },
           GridBoxSpacings->{"Columns" -> {
               Offset[0.], {
                Offset[0.034999999999999996`]}, 
               Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                Offset[0.]}}, "RowsIndexed" -> {}}],
          FontSize->Rational[39, 4]]}
       },
       GridBoxAlignment->{
        "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Center}},
          "RowsIndexed" -> {}},
       GridBoxSpacings->{"Columns" -> {
           Offset[0.27999999999999997`], {
            Offset[0.034999999999999996`]}, 
           Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
           Offset[0.2], {
            Offset[0.4]}, 
           Offset[0.2]}, "RowsIndexed" -> {}}],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`g[-$CellContext`a, -$CellContext`b],
     Editable->False], " ", 
    InterpretationBox[
     StyleBox[
      RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`RicciScalarCD[],
     Editable->False]}]}]}]], "Output"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["2. Example: Scalar-Tensor theory", "Subsection"],

Cell["\<\
Let\[CloseCurlyQuote]s add a scalar field \[Phi] with potential U(\[Phi]) and \
coupling function A(\[Phi]) in the Jordan frame. Define these objects:\
\>", "Text"],

Cell[BoxData[{
 RowBox[{"DefTensor", "[", 
  RowBox[{
   RowBox[{"\[Phi]", "[", "]"}], ",", "M4"}], "]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"DefScalarFunction", "/@", 
   RowBox[{"{", 
    RowBox[{"U", ",", "A"}], "}"}]}], ";"}]}], "Input"],

Cell["\<\
We also need a tensor perturbation \
\[Delta]\[Phi][LI[\[OpenCurlyDoubleQuote]order\[CloseCurlyDoubleQuote]]]\
\>", "Text"],

Cell[BoxData[
 RowBox[{"DefTensorPerturbation", "[", 
  RowBox[{
   RowBox[{"\[Delta]\[Phi]", "[", 
    RowBox[{"LI", "[", "\"\<order\>\"", "]"}], "]"}], ",", 
   RowBox[{"\[Phi]", "[", "]"}], ",", 
   RowBox[{"{", "M4", "}"}]}], "]"}]], "Input"],

Cell["Here is the Lagrangian for this theory", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"LST", "=", 
  RowBox[{
   RowBox[{"Sqrt", "[", 
    RowBox[{"-", 
     RowBox[{"Detg", "[", "]"}]}], "]"}], 
   RowBox[{"(", 
    RowBox[{
     RowBox[{
      RowBox[{"A", "[", 
       RowBox[{"\[Phi]", "[", "]"}], "]"}], " ", 
      RowBox[{"RicciScalarCD", "[", "]"}]}], "-", 
     RowBox[{
      FractionBox["1", "2"], 
      RowBox[{
       RowBox[{"CD", "[", 
        RowBox[{"-", "a"}], "]"}], "@", 
       RowBox[{"\[Phi]", "[", "]"}]}], " ", 
      RowBox[{
       RowBox[{"CD", "[", "a", "]"}], "@", 
       RowBox[{"\[Phi]", "[", "]"}]}]}], "-", 
     RowBox[{"U", "[", 
      RowBox[{"\[Phi]", "[", "]"}], "]"}]}], ")"}]}]}]], "Input"],

Cell[BoxData[
 RowBox[{
  SqrtBox[
   RowBox[{"-", 
    InterpretationBox[
     StyleBox[
      OverscriptBox["g", 
       OverscriptBox[
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]], 
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]]]],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`Detg[],
     Editable->False]}]], " ", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{
     RowBox[{
      InterpretationBox[
       StyleBox["A",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`A,
       Editable->False], "[", 
      InterpretationBox[
       StyleBox["\[Phi]",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`\[Phi][],
       Editable->False], "]"}], " ", 
     InterpretationBox[
      StyleBox[
       RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`RicciScalarCD[],
      Editable->False]}], "-", 
    RowBox[{
     InterpretationBox[
      StyleBox["U",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`U,
      Editable->False], "[", 
     InterpretationBox[
      StyleBox["\[Phi]",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Phi][],
      Editable->False], "]"}], "-", 
    RowBox[{
     FractionBox["1", "2"], " ", 
     RowBox[{"(", 
      InterpretationBox[
       StyleBox[
        RowBox[{
         SubscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`CD[-$CellContext`a][
        $CellContext`\[Phi][]],
       Editable->False], ")"}], " ", 
     RowBox[{"(", 
      InterpretationBox[
       StyleBox[
        RowBox[{
         SuperscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`CD[$CellContext`a][
        $CellContext`\[Phi][]],
       Editable->False], ")"}]}]}], ")"}]}]], "Output"]
}, Open  ]],

Cell["\<\
Again, get the first order variation, now much more complicated.\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"LSTpert", "=", 
  RowBox[{
   RowBox[{
    RowBox[{"ExpandPerturbation", "@", 
     RowBox[{"Perturbation", "@", "LST"}]}], "//", "ContractMetric"}], "//", 
   "Simplification"}]}]], "Input"],

Cell[BoxData[
 RowBox[{
  RowBox[{"-", 
   FractionBox["1", "4"]}], " ", 
  SqrtBox[
   RowBox[{"-", 
    InterpretationBox[
     StyleBox[
      OverscriptBox["g", 
       OverscriptBox[
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]], 
        StyleBox["~",
         FontColor->RGBColor[0, 0, 0]]]],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`Detg[],
     Editable->False]}]], " ", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"4", " ", 
     RowBox[{"(", 
      InterpretationBox[
       StyleBox[
        RowBox[{
         SubscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`CD[-$CellContext`a][
        $CellContext`\[Phi][]],
       Editable->False], ")"}], " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {"\[Delta]\[Phi]", 
          StyleBox[GridBox[{
             {"1", 
              RowBox[{";", "a"}]},
             {" ", "  "}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`CD[$CellContext`a][
       $CellContext`\[Delta]\[Phi][
        xAct`xTensor`LI[1]]],
      Editable->False]}], "-", 
    RowBox[{"2", " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {"h", 
          StyleBox[GridBox[{
             {"1", "a", "b"},
             {" ", " ", " "}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`h[
       xAct`xTensor`LI[1], $CellContext`a, $CellContext`b],
      Editable->False], " ", 
     RowBox[{"(", 
      InterpretationBox[
       StyleBox[
        RowBox[{
         SubscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`CD[-$CellContext`a][
        $CellContext`\[Phi][]],
       Editable->False], ")"}], " ", 
     RowBox[{"(", 
      InterpretationBox[
       StyleBox[
        RowBox[{
         SubscriptBox["\[EmptyDownTriangle]", "b"], "\[Phi]"}],
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`CD[-$CellContext`b][
        $CellContext`\[Phi][]],
       Editable->False], ")"}]}], "+", 
    RowBox[{
     RowBox[{
      InterpretationBox[
       StyleBox["A",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`A,
       Editable->False], "[", 
      InterpretationBox[
       StyleBox["\[Phi]",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`\[Phi][],
       Editable->False], "]"}], " ", 
     RowBox[{"(", 
      RowBox[{
       RowBox[{"4", " ", 
        InterpretationBox[
         StyleBox[GridBox[{
            {"h", 
             StyleBox[GridBox[{
                {"1", "a", "b"},
                {" ", " ", " "}
               },
               GridBoxSpacings->{"Columns" -> {
                   Offset[0.], {
                    Offset[0.034999999999999996`]}, 
                   Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                    Offset[0.]}}, "RowsIndexed" -> {}}],
              FontSize->Rational[39, 4]]}
           },
           
           GridBoxAlignment->{
            "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Center}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.034999999999999996`]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`h[
          xAct`xTensor`LI[1], $CellContext`a, $CellContext`b],
         Editable->False], " ", 
        InterpretationBox[
         StyleBox[GridBox[{
            {
             RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}], 
             StyleBox[GridBox[{
                {" ", " "},
                {"a", "b"}
               },
               GridBoxSpacings->{"Columns" -> {
                   Offset[0.], {
                    Offset[0.034999999999999996`]}, 
                   Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                    Offset[0.]}}, "RowsIndexed" -> {}}],
              FontSize->Rational[39, 4]]}
           },
           
           GridBoxAlignment->{
            "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Center}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.034999999999999996`]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`RicciCD[-$CellContext`a, -$CellContext`b],
         Editable->False]}], "-", 
       RowBox[{"2", " ", 
        InterpretationBox[
         StyleBox[GridBox[{
            {"h", 
             StyleBox[GridBox[{
                {"1", "a", " "},
                {" ", " ", "a"}
               },
               GridBoxSpacings->{"Columns" -> {
                   Offset[0.], {
                    Offset[0.034999999999999996`]}, 
                   Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                    Offset[0.]}}, "RowsIndexed" -> {}}],
              FontSize->Rational[39, 4]]}
           },
           
           GridBoxAlignment->{
            "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Center}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.034999999999999996`]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`h[
          xAct`xTensor`LI[1], $CellContext`a, -$CellContext`a],
         Editable->False], " ", 
        InterpretationBox[
         StyleBox[
          RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`RicciScalarCD[],
         Editable->False]}], "-", 
       RowBox[{"4", " ", 
        InterpretationBox[
         StyleBox[GridBox[{
            {"h", 
             StyleBox[GridBox[{
                {"1", "a", "b", "  ", "  "},
                {" ", " ", " ", 
                 RowBox[{";", "a"}], 
                 RowBox[{";", "b"}]}
               },
               GridBoxSpacings->{"Columns" -> {
                   Offset[0.], {
                    Offset[0.034999999999999996`]}, 
                   Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                    Offset[0.]}}, "RowsIndexed" -> {}}],
              FontSize->Rational[39, 4]]}
           },
           
           GridBoxAlignment->{
            "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Center}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.034999999999999996`]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`CD[-$CellContext`b][
          $CellContext`CD[-$CellContext`a][
           $CellContext`h[
            xAct`xTensor`LI[1], $CellContext`a, $CellContext`b]]],
         Editable->False]}], "+", 
       RowBox[{"4", " ", 
        InterpretationBox[
         StyleBox[GridBox[{
            {"h", 
             StyleBox[GridBox[{
                {"1", "a", " ", 
                 RowBox[{";", "b"}], "  "},
                {" ", " ", "a", "  ", 
                 RowBox[{";", "b"}]}
               },
               GridBoxSpacings->{"Columns" -> {
                   Offset[0.], {
                    Offset[0.034999999999999996`]}, 
                   Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                    Offset[0.]}}, "RowsIndexed" -> {}}],
              FontSize->Rational[39, 4]]}
           },
           
           GridBoxAlignment->{
            "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
             "Rows" -> {{Center}}, "RowsIndexed" -> {}},
           GridBoxSpacings->{"Columns" -> {
               Offset[0.27999999999999997`], {
                Offset[0.034999999999999996`]}, 
               Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
               Offset[0.2], {
                Offset[0.4]}, 
               Offset[0.2]}, "RowsIndexed" -> {}}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`CD[-$CellContext`b][
          $CellContext`CD[$CellContext`b][
           $CellContext`h[
            xAct`xTensor`LI[1], $CellContext`a, -$CellContext`a]]],
         Editable->False]}]}], ")"}]}], "+", 
    RowBox[{
     InterpretationBox[
      StyleBox[GridBox[{
         {"h", 
          StyleBox[GridBox[{
             {"1", "a", " "},
             {" ", " ", "a"}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`h[
       xAct`xTensor`LI[1], $CellContext`a, -$CellContext`a],
      Editable->False], " ", 
     RowBox[{"(", 
      RowBox[{
       RowBox[{"2", " ", 
        RowBox[{
         InterpretationBox[
          StyleBox["U",
           ShowAutoStyles->False,
           AutoSpacing->False],
          $CellContext`U,
          Editable->False], "[", 
         InterpretationBox[
          StyleBox["\[Phi]",
           ShowAutoStyles->False,
           AutoSpacing->False],
          $CellContext`\[Phi][],
          Editable->False], "]"}]}], "+", 
       RowBox[{
        RowBox[{"(", 
         InterpretationBox[
          StyleBox[
           RowBox[{
            SubscriptBox["\[EmptyDownTriangle]", "b"], "\[Phi]"}],
           ShowAutoStyles->False,
           AutoSpacing->False],
          $CellContext`CD[-$CellContext`b][
           $CellContext`\[Phi][]],
          Editable->False], ")"}], " ", 
        RowBox[{"(", 
         InterpretationBox[
          StyleBox[
           RowBox[{
            SuperscriptBox["\[EmptyDownTriangle]", "b"], "\[Phi]"}],
           ShowAutoStyles->False,
           AutoSpacing->False],
          $CellContext`CD[$CellContext`b][
           $CellContext`\[Phi][]],
          Editable->False], ")"}]}]}], ")"}]}], "-", 
    RowBox[{"4", " ", 
     InterpretationBox[
      StyleBox[
       RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`RicciScalarCD[],
      Editable->False], " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {"\[Delta]\[Phi]", 
          StyleBox[GridBox[{
             {"1"},
             {" "}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Delta]\[Phi][
       xAct`xTensor`LI[1]],
      Editable->False], " ", 
     RowBox[{
      SuperscriptBox[
       InterpretationBox[
        StyleBox["A",
         ShowAutoStyles->False,
         AutoSpacing->False],
        $CellContext`A,
        Editable->False], "\[Prime]",
       MultilineFunction->None], "[", 
      InterpretationBox[
       StyleBox["\[Phi]",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`\[Phi][],
       Editable->False], "]"}]}], "+", 
    RowBox[{"4", " ", 
     InterpretationBox[
      StyleBox[GridBox[{
         {"\[Delta]\[Phi]", 
          StyleBox[GridBox[{
             {"1"},
             {" "}
            },
            GridBoxSpacings->{"Columns" -> {
                Offset[0.], {
                 Offset[0.034999999999999996`]}, 
                Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                 Offset[0.]}}, "RowsIndexed" -> {}}],
           FontSize->Rational[39, 4]]}
        },
        GridBoxAlignment->{
         "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
          "Rows" -> {{Center}}, "RowsIndexed" -> {}},
        GridBoxSpacings->{"Columns" -> {
            Offset[0.27999999999999997`], {
             Offset[0.034999999999999996`]}, 
            Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, 
          "Rows" -> {
            Offset[0.2], {
             Offset[0.4]}, 
            Offset[0.2]}, "RowsIndexed" -> {}}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Delta]\[Phi][
       xAct`xTensor`LI[1]],
      Editable->False], " ", 
     RowBox[{
      SuperscriptBox[
       InterpretationBox[
        StyleBox["U",
         ShowAutoStyles->False,
         AutoSpacing->False],
        $CellContext`U,
        Editable->False], "\[Prime]",
       MultilineFunction->None], "[", 
      InterpretationBox[
       StyleBox["\[Phi]",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`\[Phi][],
       Editable->False], "]"}]}]}], ")"}]}]], "Output"]
}, Open  ]],

Cell["\<\
Now again vary with respect to the first order perturbations h[LI[1],a,b] and \
\[Delta]\[Phi][LI[1]].\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"EOMgST0", "=", 
  RowBox[{"0", "==", 
   RowBox[{"Collect", "[", 
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{
        FractionBox[
         RowBox[{"-", "1"}], 
         RowBox[{"Sqrt", "[", 
          RowBox[{"-", 
           RowBox[{"Detg", "[", "]"}]}], "]"}]], 
        RowBox[{
         RowBox[{"VarD", "[", 
          RowBox[{
           RowBox[{"h", "[", 
            RowBox[{
             RowBox[{"LI", "[", "1", "]"}], ",", "a", ",", "b"}], "]"}], ",", 
           "CD"}], "]"}], "@", "LSTpert"}]}], "/.", 
       RowBox[{
        RowBox[{"delta", "[", 
         RowBox[{
          RowBox[{"-", 
           RowBox[{"LI", "[", "1", "]"}]}], ",", 
          RowBox[{"LI", "[", "1", "]"}]}], "]"}], "\[Rule]", "1"}]}], "//", 
      "Expand"}], ",", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"A", "[", "_", "]"}], ",", 
       RowBox[{
        RowBox[{
         RowBox[{"Derivative", "[", "_", "]"}], "[", "A", "]"}], "[", "_", 
        "]"}]}], "}"}]}], "]"}]}]}]], "Input"],

Cell[BoxData[
 RowBox[{"0", "\[Equal]", 
  RowBox[{
   RowBox[{
    RowBox[{
     InterpretationBox[
      StyleBox["A",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`A,
      Editable->False], "[", 
     InterpretationBox[
      StyleBox["\[Phi]",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Phi][],
      Editable->False], "]"}], " ", 
    RowBox[{"(", 
     RowBox[{
      InterpretationBox[
       StyleBox[GridBox[{
          {
           RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}], 
           StyleBox[GridBox[{
              {" ", " "},
              {"a", "b"}
             },
             GridBoxSpacings->{"Columns" -> {
                 Offset[0.], {
                  Offset[0.034999999999999996`]}, 
                 Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                  Offset[0.]}}, "RowsIndexed" -> {}}],
            FontSize->Rational[39, 4]]}
         },
         GridBoxAlignment->{
          "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
           "Rows" -> {{Center}}, "RowsIndexed" -> {}},
         GridBoxSpacings->{"Columns" -> {
             Offset[0.27999999999999997`], {
              Offset[0.034999999999999996`]}, 
             Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
             Offset[0.2], {
              Offset[0.4]}, 
             Offset[0.2]}, "RowsIndexed" -> {}}],
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`RicciCD[-$CellContext`a, -$CellContext`b],
       Editable->False], "-", 
      RowBox[{
       FractionBox["1", "2"], " ", 
       InterpretationBox[
        StyleBox[GridBox[{
           {"g", 
            StyleBox[GridBox[{
               {" ", " "},
               {"a", "b"}
              },
              GridBoxSpacings->{"Columns" -> {
                  Offset[0.], {
                   Offset[0.034999999999999996`]}, 
                  Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                   Offset[0.]}}, "RowsIndexed" -> {}}],
             FontSize->Rational[39, 4]]}
          },
          
          GridBoxAlignment->{
           "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
            "Rows" -> {{Center}}, "RowsIndexed" -> {}},
          GridBoxSpacings->{"Columns" -> {
              Offset[0.27999999999999997`], {
               Offset[0.034999999999999996`]}, 
              Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
              Offset[0.2], {
               Offset[0.4]}, 
              Offset[0.2]}, "RowsIndexed" -> {}}],
         ShowAutoStyles->False,
         AutoSpacing->False],
        $CellContext`g[-$CellContext`a, -$CellContext`b],
        Editable->False], " ", 
       InterpretationBox[
        StyleBox[
         RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
         ShowAutoStyles->False,
         AutoSpacing->False],
        $CellContext`RicciScalarCD[],
        Editable->False]}]}], ")"}]}], "+", 
   RowBox[{
    FractionBox["1", "2"], " ", 
    InterpretationBox[
     StyleBox[GridBox[{
        {"g", 
         StyleBox[GridBox[{
            {" ", " "},
            {"a", "b"}
           },
           GridBoxSpacings->{"Columns" -> {
               Offset[0.], {
                Offset[0.034999999999999996`]}, 
               Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                Offset[0.]}}, "RowsIndexed" -> {}}],
          FontSize->Rational[39, 4]]}
       },
       GridBoxAlignment->{
        "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Center}},
          "RowsIndexed" -> {}},
       GridBoxSpacings->{"Columns" -> {
           Offset[0.27999999999999997`], {
            Offset[0.034999999999999996`]}, 
           Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
           Offset[0.2], {
            Offset[0.4]}, 
           Offset[0.2]}, "RowsIndexed" -> {}}],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`g[-$CellContext`a, -$CellContext`b],
     Editable->False], " ", 
    RowBox[{
     InterpretationBox[
      StyleBox["U",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`U,
      Editable->False], "[", 
     InterpretationBox[
      StyleBox["\[Phi]",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Phi][],
      Editable->False], "]"}]}], "-", 
   RowBox[{
    FractionBox["1", "2"], " ", 
    RowBox[{"(", 
     InterpretationBox[
      StyleBox[
       RowBox[{
        SubscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`CD[-$CellContext`a][
       $CellContext`\[Phi][]],
      Editable->False], ")"}], " ", 
    RowBox[{"(", 
     InterpretationBox[
      StyleBox[
       RowBox[{
        SubscriptBox["\[EmptyDownTriangle]", "b"], "\[Phi]"}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`CD[-$CellContext`b][
       $CellContext`\[Phi][]],
      Editable->False], ")"}]}], "+", 
   RowBox[{
    FractionBox["1", "4"], " ", 
    InterpretationBox[
     StyleBox[GridBox[{
        {"g", 
         StyleBox[GridBox[{
            {" ", " "},
            {"a", "b"}
           },
           GridBoxSpacings->{"Columns" -> {
               Offset[0.], {
                Offset[0.034999999999999996`]}, 
               Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                Offset[0.]}}, "RowsIndexed" -> {}}],
          FontSize->Rational[39, 4]]}
       },
       GridBoxAlignment->{
        "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Center}},
          "RowsIndexed" -> {}},
       GridBoxSpacings->{"Columns" -> {
           Offset[0.27999999999999997`], {
            Offset[0.034999999999999996`]}, 
           Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
           Offset[0.2], {
            Offset[0.4]}, 
           Offset[0.2]}, "RowsIndexed" -> {}}],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`g[-$CellContext`a, -$CellContext`b],
     Editable->False], " ", 
    RowBox[{"(", 
     InterpretationBox[
      StyleBox[
       RowBox[{
        SubscriptBox["\[EmptyDownTriangle]", "c"], "\[Phi]"}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`CD[-$CellContext`c][
       $CellContext`\[Phi][]],
      Editable->False], ")"}], " ", 
    RowBox[{"(", 
     InterpretationBox[
      StyleBox[
       RowBox[{
        SuperscriptBox["\[EmptyDownTriangle]", "c"], "\[Phi]"}],
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`CD[$CellContext`c][
       $CellContext`\[Phi][]],
      Editable->False], ")"}]}], "+", 
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      RowBox[{"-", 
       RowBox[{"(", 
        InterpretationBox[
         StyleBox[
          RowBox[{
           SubscriptBox["\[EmptyDownTriangle]", "b"], 
           SubscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`CD[-$CellContext`b][
          $CellContext`CD[-$CellContext`a][
           $CellContext`\[Phi][]]],
         Editable->False], ")"}]}], "+", 
      RowBox[{
       InterpretationBox[
        StyleBox[GridBox[{
           {"g", 
            StyleBox[GridBox[{
               {" ", " "},
               {"a", "b"}
              },
              GridBoxSpacings->{"Columns" -> {
                  Offset[0.], {
                   Offset[0.034999999999999996`]}, 
                  Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                   Offset[0.]}}, "RowsIndexed" -> {}}],
             FontSize->Rational[39, 4]]}
          },
          
          GridBoxAlignment->{
           "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
            "Rows" -> {{Center}}, "RowsIndexed" -> {}},
          GridBoxSpacings->{"Columns" -> {
              Offset[0.27999999999999997`], {
               Offset[0.034999999999999996`]}, 
              Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
              Offset[0.2], {
               Offset[0.4]}, 
              Offset[0.2]}, "RowsIndexed" -> {}}],
         ShowAutoStyles->False,
         AutoSpacing->False],
        $CellContext`g[-$CellContext`a, -$CellContext`b],
        Editable->False], " ", 
       RowBox[{"(", 
        InterpretationBox[
         StyleBox[
          RowBox[{
           SubscriptBox["\[EmptyDownTriangle]", "c"], 
           SuperscriptBox["\[EmptyDownTriangle]", "c"], "\[Phi]"}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`CD[-$CellContext`c][
          $CellContext`CD[$CellContext`c][
           $CellContext`\[Phi][]]],
         Editable->False], ")"}]}]}], ")"}], " ", 
    RowBox[{
     SuperscriptBox[
      InterpretationBox[
       StyleBox["A",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`A,
       Editable->False], "\[Prime]",
      MultilineFunction->None], "[", 
     InterpretationBox[
      StyleBox["\[Phi]",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Phi][],
      Editable->False], "]"}]}], "+", 
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      RowBox[{
       RowBox[{"-", 
        RowBox[{"(", 
         InterpretationBox[
          StyleBox[
           RowBox[{
            SubscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
           ShowAutoStyles->False,
           AutoSpacing->False],
          $CellContext`CD[-$CellContext`a][
           $CellContext`\[Phi][]],
          Editable->False], ")"}]}], " ", 
       RowBox[{"(", 
        InterpretationBox[
         StyleBox[
          RowBox[{
           SubscriptBox["\[EmptyDownTriangle]", "b"], "\[Phi]"}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`CD[-$CellContext`b][
          $CellContext`\[Phi][]],
         Editable->False], ")"}]}], "+", 
      RowBox[{
       InterpretationBox[
        StyleBox[GridBox[{
           {"g", 
            StyleBox[GridBox[{
               {" ", " "},
               {"a", "b"}
              },
              GridBoxSpacings->{"Columns" -> {
                  Offset[0.], {
                   Offset[0.034999999999999996`]}, 
                  Offset[0.]}, "ColumnsIndexed" -> {}, "Rows" -> {{
                   Offset[0.]}}, "RowsIndexed" -> {}}],
             FontSize->Rational[39, 4]]}
          },
          
          GridBoxAlignment->{
           "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
            "Rows" -> {{Center}}, "RowsIndexed" -> {}},
          GridBoxSpacings->{"Columns" -> {
              Offset[0.27999999999999997`], {
               Offset[0.034999999999999996`]}, 
              Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
              Offset[0.2], {
               Offset[0.4]}, 
              Offset[0.2]}, "RowsIndexed" -> {}}],
         ShowAutoStyles->False,
         AutoSpacing->False],
        $CellContext`g[-$CellContext`a, -$CellContext`b],
        Editable->False], " ", 
       RowBox[{"(", 
        InterpretationBox[
         StyleBox[
          RowBox[{
           SubscriptBox["\[EmptyDownTriangle]", "c"], "\[Phi]"}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`CD[-$CellContext`c][
          $CellContext`\[Phi][]],
         Editable->False], ")"}], " ", 
       RowBox[{"(", 
        InterpretationBox[
         StyleBox[
          RowBox[{
           SuperscriptBox["\[EmptyDownTriangle]", "c"], "\[Phi]"}],
          ShowAutoStyles->False,
          AutoSpacing->False],
         $CellContext`CD[$CellContext`c][
          $CellContext`\[Phi][]],
         Editable->False], ")"}]}]}], ")"}], " ", 
    RowBox[{
     SuperscriptBox[
      InterpretationBox[
       StyleBox["A",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`A,
       Editable->False], "\[Prime]\[Prime]",
      MultilineFunction->None], "[", 
     InterpretationBox[
      StyleBox["\[Phi]",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Phi][],
      Editable->False], "]"}]}]}]}]], "Output"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"EOM\[Phi]ST0", "=", 
  RowBox[{
   RowBox[{
    RowBox[{"0", "==", 
     RowBox[{
      FractionBox["1", 
       RowBox[{"Sqrt", "[", 
        RowBox[{"-", 
         RowBox[{"Detg", "[", "]"}]}], "]"}]], 
      RowBox[{
       RowBox[{"VarD", "[", 
        RowBox[{
         RowBox[{"\[Delta]\[Phi]", "[", 
          RowBox[{"LI", "[", "1", "]"}], "]"}], ",", "CD"}], "]"}], "@", 
       "LSTpert"}]}]}], "/.", 
    RowBox[{
     RowBox[{"delta", "[", 
      RowBox[{
       RowBox[{"-", 
        RowBox[{"LI", "[", "1", "]"}]}], ",", 
       RowBox[{"LI", "[", "1", "]"}]}], "]"}], "\[Rule]", "1"}]}], "//", 
   "Expand"}]}]], "Input"],

Cell[BoxData[
 RowBox[{"0", "\[Equal]", 
  RowBox[{
   InterpretationBox[
    StyleBox[
     RowBox[{
      SubscriptBox["\[EmptyDownTriangle]", "a"], 
      SuperscriptBox["\[EmptyDownTriangle]", "a"], "\[Phi]"}],
     ShowAutoStyles->False,
     AutoSpacing->False],
    $CellContext`CD[-$CellContext`a][
     $CellContext`CD[$CellContext`a][
      $CellContext`\[Phi][]]],
    Editable->False], "+", 
   RowBox[{
    InterpretationBox[
     StyleBox[
      RowBox[{"R", "[", "\[EmptyDownTriangle]", "]"}],
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`RicciScalarCD[],
     Editable->False], " ", 
    RowBox[{
     SuperscriptBox[
      InterpretationBox[
       StyleBox["A",
        ShowAutoStyles->False,
        AutoSpacing->False],
       $CellContext`A,
       Editable->False], "\[Prime]",
      MultilineFunction->None], "[", 
     InterpretationBox[
      StyleBox["\[Phi]",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`\[Phi][],
      Editable->False], "]"}]}], "-", 
   RowBox[{
    SuperscriptBox[
     InterpretationBox[
      StyleBox["U",
       ShowAutoStyles->False,
       AutoSpacing->False],
      $CellContext`U,
      Editable->False], "\[Prime]",
     MultilineFunction->None], "[", 
    InterpretationBox[
     StyleBox["\[Phi]",
      ShowAutoStyles->False,
      AutoSpacing->False],
     $CellContext`\[Phi][],
     Editable->False], "]"}]}]}]], "Output"]
}, Open  ]]
}, Open  ]]
}, Open  ]]
},
WindowSize->{868, 789},
WindowMargins->{{619, Automatic}, {Automatic, 210}},
PrivateNotebookOptions->{"FileOutlineCache"->False},
TrackCellChangeTimes->False,
FrontEndVersion->"9.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (January 25, \
2013)",
StyleDefinitions->"Default.nb"
]

